package geektime.spring.springbucks.customerservice.integration;

import geektime.spring.springbucks.customerservice.model.Coffee;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "my-consul-waiter-service", contextId = "coffee", path = "/coffee", fallback = FallbackCoffeeService.class, qualifier = "my-qualifier")
public interface CoffeeService {

    @GetMapping(path = "/", params = "!name")
    List<Coffee> getAll();

    @GetMapping("/{id}")
    Coffee getById(@PathVariable(value = "id") Long id);

    @GetMapping(path = "/", params = "name")
    Coffee getByName(@RequestParam(value = "name") String name);
}
